home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / comm / mebbs / usage03.lha / usage.rexx < prev   
OS/2 REXX Batch file  |  1994-07-08  |  4KB  |  69 lines

  1. /* Usage Chart - Shows a bar chart of BBS Hourly Usage - by Larry Cloud M3001 */
  2. bbsname="Kitt's Korner";bulpath="bulletins:"
  3. parse arg line bulnum
  4. if line < 1 | line > 9 then line=1
  5. vers="0.3";bbs="For "bbsname" BBS";l=(80-length(bbs))/2%1;do i=1 to l;sp=sp||" ";end
  6. if (upper(bulnum)="RESET") | (~exists("mebbsnet:configfiles/usage_"line".cfg")) then do
  7.  call open(file,"mebbsnet:configfiles/usage_"line".cfg","w");call writeln(file,"1")
  8.  do i=0 to 48;call writeln(file,"1");end
  9. end 
  10. if bulnum="RESET" then bulnum=999
  11. line=strip(line);bulnum=strip(bulnum);do i=0 to 24;tyme.i=0;end
  12. do i=0 to 23;tyme.i=0;end;c=0;call open(file,"MEBBSNET:MEBBSNET"line".LOG","r")
  13. do until eof(file)
  14.  x=readln(file)||" junk";parse upper var x junk1 junk2 tyme item junk3
  15.  if item="NORM." then sflag=tyme
  16.  if item="LOGOFF" then do;c=c+1;data.c.1=sflag;data.c.2=tyme;end
  17. end;call close(file)
  18. do i=0 to 23;e=i+1
  19.  do j=1 to c
  20.   if value(left(data.j.1,2))=i then do
  21.    a=value(right(data.j.1,2));b=value(right(data.j.2,2));d=b-a
  22.    if d>0 then do;tyme.i=tyme.i+d;end
  23.    else do;tyme.i=tyme.i+(60-a);tyme.e=tyme.e+b;end
  24.   end
  25.  end
  26. end
  27. do i=0 to 23
  28.  if tyme.i>60 then do
  29.   e=i+1;f=(tyme.i)-60;tyme.e=(tyme.e)+f;tyme.i=60
  30.  end
  31. end
  32. call open(file,"MEBBSNET:CONFIGFILES/usage_"line".CFG","R");days=readln(file)
  33. do i=0 to 23;rawstat.i=readln(file);avestat.i=readln(file);end;call close(file);days=days+1
  34. do i=0 to 23;rawstat.i=rawstat.i+tyme.i;avestat.i=(rawstat.i/days);end
  35. call open(file,"MEBBSNET:CONFIGFILES/usage_"line".CFG","W");call writeln(file,days)
  36. do i=0 to 23;call writeln(file,rawstat.i);call writeln(file,avestat.i);end;call close(file)
  37. do i=0 to 23;x=avestat.i
  38.  do j=6 to 60 by 6;k=j/6;stats.i.k="  ";if x>=j then stats.i.k="XX"
  39.  end
  40.  do j=6 to 60 by 6;k=j/6;ans.i.k="  ";if x>=j then ans.i.k="²²"
  41.  end
  42. end
  43. string1="                 Usage Chart version "vers" by Larry Cloud M3001";string2="                  Chart For Line "line", averaged over "days" days."
  44. call open(file,bulpath||"bul"bulnum".txt","W")
  45. call writeln(file,string1);call writeln(file,string2);call writeln(file,sp||bbs);call writeln(file," ");call writeln(file," ")
  46. s1="    12 01 02 03 04 05 06 07 08 09 10 11 12 01 02 03 04 05 06 07 08 09 10 11";s2="   --------------------------------------------------------------------------"
  47. s3="Numbers across are hours of the day, numbers down are minutes of use.";call writeln(file,s1);call writeln(file,s2)
  48. do j=60 to 6 by -6;string=j;if j=6 then string="06"
  49.  string=string||"| "
  50.  do i=0 to 23;k=j/6;string=string||stats.i.k||" ";end
  51.  call writeln(file,string||"|")
  52. end
  53. call writeln(file,s2);call writeln(file,s1);call writeln(file," ");call writeln(file,s3)
  54. call writeln(file," ");call writeln(file,"~vc ");call close(file)
  55. string1="                 Usage Chart version "vers" by Larry Cloud M3001"
  56. string2="                  Chart For Line "line", averaged over "days" days."
  57. call open(file2,bulpath||"bul"bulnum".gr1","W")
  58. call writeln(file2,string1);call writeln(file2,string2);call writeln(file2,sp||""bbs);call writeln(file2," ");call writeln(file2," ")
  59. s1="    12 01 02 03 04 05 06 07 08 09 10 11 12 01 02 03 04 05 06 07 08 09 10 11";s2="   --------------------------------------------------------------------------"
  60. call writeln(file2,s1);call writeln(file2,s2)
  61. do j=60 to 6 by -6;string=""||j;if j=6 then string="06"
  62.  string=string||"| "
  63.  do i=0 to 23;k=j/6;string=string||ans.i.k||" ";end
  64.  call writeln(file2,string||"|")
  65. end
  66. call writeln(file2,s2);call writeln(file2,s1);call writeln(file2," ");call writeln(file2,s3);call writeln(file2," ");call writeln(file2,"~vc ");call close(file2)
  67. say"Usage Chart - Another fine Arexx Script by Larry Cloud, M3001."
  68. exit
  69.